package com.base.cn.platform.os.controller.mobile.qa.thumb;

import com.base.cn.platform.os.common.MobileBaseController;
import com.base.cn.platform.os.service.course.qa.thumb.QaThumbService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.Map;

/**
 * H5问题点赞Controller
 * @author LIZHIPENG
 * @create 2018-06-13 下午 2:24
 */
@Controller
@RequestMapping("/mobile")
public class MobileQaThumbController extends MobileBaseController {

    @Autowired
    private QaThumbService qaThumbService;

    /**
     * 问题点赞
     * @param request HttpServletRequest
     * @param questionId 问题id
     * @return Map<String, Object>
     */
    @RequestMapping("/uc/qa/thumbQuestion")
    @ResponseBody
    public Map<String, Object> thumbQuestion(HttpServletRequest request,
                                             @RequestParam("questionId")BigDecimal questionId){
        BigDecimal userId = webMobileLoginUtil.getLoginUserId(request);
        return qaThumbService.thumbQuestion(questionId, userId);
    }
}
